/* spipc.h */

/**********************/
/* INTER-PROCESS-COMM */
/* for Secure Phone   */
/* Version 1.03, 23.9 */
/* (C) 2003 by NAH6   */
/**********************/

#ifndef __SPIPC_H
#define __SPIPC_H

// uncomment this line if you want to be able to debug spipc messages
// in order for this to work, the sizeof(SPIPC_HEADER) in command.c must
// not be replaced by '8'!!!
// #define _DEBUG_IPCMESSAGES 1

#ifdef SPIPC_EXPORTS
#ifdef __cplusplus
#define SPIPC_PUBLIC extern "C" __declspec (dllexport)
#else
#define SPIPC_PUBLIC __declspec (dllexport)
#endif
#else
#ifdef __cplusplus
#define SPIPC_PUBLIC extern "C" __declspec (dllimport)
#else
#define SPIPC_PUBLIC __declspec (dllimport)
#endif
#endif


/*------------*/
/*  INCLUDES  */
/*------------*/

#include <windows.h>

/*-----------*/
/*  DEFINES  */
/*-----------*/

/* Error numbers */
#define E_SPIPC_OK                (0x0000)
#define E_SPIPC_UNKNOWN          (-0x1801)
#define E_SPIPC_NULLPTR          (-0x1802)
#define E_SPIPC_BADQUEUE         (-0x1803)
#define E_SPIPC_BADNOTIFY        (-0x1804)
#define E_SPIPC_STRUCT2SMALL     (-0x1805)
#define E_SPIPC_STRUCT2BIG       (-0x1806)
#define E_SPIPC_EMPTY            (-0x1807)
#define E_SPIPC_FULL             (-0x1808)
#define E_SPIPC_ATOMICWAIT       (-0x1809)
#define E_SPIPC_ATOMICTIME       (-0x180A)
#define E_SPIPC_ATOMICFREE       (-0x180B)
#define E_SPIPC_EVENTWAIT        (-0x180C)
#define E_SPIPC_EVENTCLR         (-0x180D)
#define E_SPIPC_EVENTSET         (-0x180E)
#define E_SPIPC_BADBUFFER        (-0x180F)

#define E_SPIPC_CMD_BADOPCODE    (-0x1901)
#define E_SPIPC_CMD_BADLENGTH    (-0x1902)
#define E_SPIPC_CMD_BADVALUE     (-0x1903)
#define E_SPIPC_CMD_FAILED       (-0x1904)

/*====*/

/* Versioninfo */
#define K_SPIPC_MAGIC        (0x9D25CAB3L)
#define K_SPIPC_IFVER               (0x01)
#define K_SPIPC_IFREV               (0x00)
#define K_SPIPC_IFOPT             (0x0000)

/*----*/

/* Queue numbers */
#define K_SPIPC_QUEUE_COMMAND          (0)
#define K_SPIPC_QUEUE_RESULT           (1)

/*----*/

/* Notify message */
#define WM_SPIPC_MESSAGE     (WM_USER+666)

/* Notify types */
#define K_SPIPC_NOTIFY_RXRDY           (0)
#define K_SPIPC_NOTIFY_TXRDY           (1)

/*====*/
                         /* UI->MACHINE */
/* Command opcodes */
#define SPIPC_CMD_VERSION         (0x0000)
#define SPIPC_CMD_PING            (0x0001)
#define SPIPC_CMD_EXIT            (0x0002)
#define SPIPC_CMD_OFF             (0x0003)
#define SPIPC_CMD_ON              (0x0004)
#define SPIPC_CMD_HWINFO          (0x0005)
#define SPIPC_CMD_AUTOCFG         (0x0006)
#define SPIPC_CMD_SETCFG          (0x0007)
#define SPIPC_CMD_GETCFG          (0x0008)

#define SPIPC_CMD_SETOUTVOL       (0x0010)
#define SPIPC_CMD_GETOUTVOL       (0x0011)
#define SPIPC_CMD_SETINVOL        (0x0012)
#define SPIPC_CMD_GETINVOL        (0x0013)
#define SPIPC_CMD_SETINMUX        (0x0014)
#define SPIPC_CMD_GETINMUX        (0x0015)

#define SPIPC_CMD_DTMFOFF         (0x0020)
#define SPIPC_CMD_DTMFON          (0x0021)
#define SPIPC_CMD_DTMFDIAL        (0x0022)

#define SPIPC_CMD_SETDECSTATE     (0x0040)
#define SPIPC_CMD_GETDECSTATE     (0x0041)
#define SPIPC_CMD_SETDECMODE      (0x0042)
#define SPIPC_CMD_GETDECMODE      (0x0043)
#define SPIPC_CMD_SETDECCODECTBL  (0x0044)
#define SPIPC_CMD_GETDECCODECTBL  (0x0045)
#define SPIPC_CMD_GETDECCODEC     (0x0046)
#define SPIPC_CMD_GETDECSYNC      (0x0047)

#define SPIPC_CMD_SETENCSTATE     (0x0060)
#define SPIPC_CMD_GETENCSTATE     (0x0061)
#define SPIPC_CMD_SETENCMODE      (0x0062)
#define SPIPC_CMD_GETENCMODE      (0x0063)
#define SPIPC_CMD_SETENCCODECTBL  (0x0064)
#define SPIPC_CMD_GETENCCODECTBL  (0x0065)
#define SPIPC_CMD_SETENCCODEC     (0x0066)
#define SPIPC_CMD_GETENCCODEC     (0x0067)

#define SPIPC_CMD_TXUSERDATA      (0x0080)

#define SPIPC_CMD_GETRANDOM       (0x00E0)

#define SPIPC_CMD_HANGUP          (0x0100)
#define SPIPC_CMD_ANSWER          (0x0101)
#define SPIPC_CMD_DIAL            (0x0102)

/*----*/
                         /* MACHINE->UI */
/* Final command results */
#define SPIPC_RES_VERSION         (0x8000)
#define SPIPC_RES_PONG            (0x8001)
#define SPIPC_RES_EXIT            (0x8002)
#define SPIPC_RES_OK              (0x8003)
#define SPIPC_RES_ERROR           (0x8004)
#define SPIPC_RES_HWINFO          (0x8005)
#define SPIPC_RES_GETCFG          (0x8006)

#define SPIPC_RES_GETOUTVOL       (0x8010)
#define SPIPC_RES_GETINVOL        (0x8011)
#define SPIPC_RES_GETINMUX        (0x8012)

#define SPIPC_RES_GETDECSTATE     (0x8040)
#define SPIPC_RES_GETDECMODE      (0x8041)
#define SPIPC_RES_GETDECCODECTBL  (0x8042)
#define SPIPC_RES_GETDECCODEC     (0x8043)
#define SPIPC_RES_GETDECSYNC      (0x8044)

#define SPIPC_RES_GETENCSTATE     (0x8060)
#define SPIPC_RES_GETENCMODE      (0x8061)
#define SPIPC_RES_GETENCCODECTBL  (0x8062)
#define SPIPC_RES_GETENCCODEC     (0x8063)

#define SPIPC_RES_GETRANDOM       (0x80E0)

#define SPIPC_RES_DISCONNECT      (0x8100)
#define SPIPC_RES_CONNECT         (0x8101)

/* Intermediate progress */
#define SPIPC_PRO_NEWSTATE        (0x8200)
#define SPIPC_PRO_HANGUPSTART     (0x8201)
#define SPIPC_PRO_ANSWERSTART     (0x8202)
#define SPIPC_PRO_DIALSTART       (0x8203)

/* Asynchronous events */
#define SPIPC_EVT_RINGOFF         (0x8300)
#define SPIPC_EVT_RINGON          (0x8301)
#define SPIPC_EVT_RING            (0x8302)
#define SPIPC_EVT_CALLERID        (0x8303)
#define SPIPC_EVT_HANGUP          (0x8304)

/* Stream multiplexer */
#define SPIPC_MUX_RXUSERDATA      (0x8400)
#define SPIPC_MUX_TXUSERDATA      (0x8401)

/* Protocol status */
#define SPIPC_PRT_RXSYNC          (0x8500)
#define SPIPC_PRT_RXCODEC         (0x8501)

/* Dummy wndmsg txrdy */
#define SPIPC_DUMMY_TXRDY         (0xFFFF)

/*====*/

/* Msgid for events */
#define SPIPC_MSGID_EVENT    (0xFFFFFFFFL)

/* Timeout specials */
#define SPIPC_TIME_NOWAIT    (0x00000000L)
#define SPIPC_TIME_FOREVER   (0xFFFFFFFFL)

/* Audio ports */
#define SPIPC_AUDIOOUT_SPEAKER         (0)
#define SPIPC_AUDIOOUT_HEADPHONE       (1)
#define SPIPC_AUDIOOUT_LINE            (2)
#define SPIPC_AUDIOOUT_TEL             (3)

#define SPIPC_AUDIOIN_MUTE             (0)
#define SPIPC_AUDIOIN_MIC              (1)
#define SPIPC_AUDIOIN_AUX              (2)
#define SPIPC_AUDIOIN_LINE             (3)
#define SPIPC_AUDIOIN_TEL              (4)

/* Coding modes */
#define SPIPC_MODE_SILENT              (0)
#define SPIPC_MODE_VOICE               (1)

/* Voice compression */
#define SPIPC_CODEC_CELP               (6)

/* Sync states */
#define SPIPC_SYNC_NONE                (0)
#define SPIPC_SYNC_OUTSIDE             (1)
#define SPIPC_SYNC_INSIDE              (2)

/* Bearer modes */
#define SPIPC_LINKMEDIA_TEL            (0)
#define SPIPC_LINKMEDIA_IP             (1)
#define SPIPC_LINKMEDIA_UNKNOWN      (255)

#define SPIPC_LINKSERVICE_DATA         (0)
#define SPIPC_LINKSERVICE_FAX          (1)
#define SPIPC_LINKSERVICE_VOICE        (2)
#define SPIPC_LINKSERVICE_UNKNOWN    (255)

#define SPIPC_LINKCARRIER_DIG          (0)
#define SPIPC_LINKCARRIER_ANA          (1)
#define SPIPC_LINKCARRIER_UNKNOWN    (255)

#define SPIPC_LINKPROTOCOL_RAW         (0)
#define SPIPC_LINKPROTOCOL_REL         (1)
#define SPIPC_LINKPROTOCOL_RELCOMP     (2)
#define SPIPC_LINKPROTOCOL_UNKNOWN   (255)

/* Disconnect reasons */
#define SPIPC_DISCONNECT_UNSPECIFIED       (0x00)
#define SPIPC_DISCONNECT_LOC_UNSPECIFIED   (0x01)
#define SPIPC_DISCONNECT_LOC_PARAMETER     (0x02)
#define SPIPC_DISCONNECT_LOC_SOFTWARE      (0x03)
#define SPIPC_DISCONNECT_LOC_MODEMTALK     (0x04)
#define SPIPC_DISCONNECT_MDM_UNSPECIFIED   (0x10)
#define SPIPC_DISCONNECT_MDM_LINECURRENT   (0x11)
#define SPIPC_DISCONNECT_MDM_NOSIM         (0x12)
#define SPIPC_DISCONNECT_MDM_NOPIN         (0x13)
#define SPIPC_DISCONNECT_MDM_NONET         (0x14)
#define SPIPC_DISCONNECT_NET_UNSPECIFIED   (0x20)
#define SPIPC_DISCONNECT_NET_DIALDELAY     (0x21)
#define SPIPC_DISCONNECT_NET_BLACKLISTED   (0x22)
#define SPIPC_DISCONNECT_NET_NUMINVALID    (0x23)
#define SPIPC_DISCONNECT_NET_NUMCHANGED    (0x24)
#define SPIPC_DISCONNECT_NET_INCOMPATIBLE  (0x25)
#define SPIPC_DISCONNECT_NET_NODIALTONE    (0x26)
#define SPIPC_DISCONNECT_NET_OUTOFORDER    (0x27)
#define SPIPC_DISCONNECT_NET_TEMPFAILURE   (0x28)
#define SPIPC_DISCONNECT_NET_OVERLOAD      (0x29)
#define SPIPC_DISCONNECT_USR_UNSPECIFIED   (0x30)
#define SPIPC_DISCONNECT_USR_HANGUP_LOC    (0x31)
#define SPIPC_DISCONNECT_USR_HANGUP_REM    (0x32)
#define SPIPC_DISCONNECT_USR_PICKUP        (0x33)
#define SPIPC_DISCONNECT_USR_FORWARD       (0x34)
#define SPIPC_DISCONNECT_USR_VOICE         (0x35)
#define SPIPC_DISCONNECT_USR_NOANSWER      (0x36)
#define SPIPC_DISCONNECT_USR_UNREACHABLE   (0x37)
#define SPIPC_DISCONNECT_USR_BUSY          (0x38)
#define SPIPC_DISCONNECT_USR_REJECT        (0x39)
#define SPIPC_DISCONNECT_USR_DISTURB       (0x3A)

/* Call states */
#define SPIPC_CALLSTATE_IDLE           (0)
#define SPIPC_CALLSTATE_RING           (1)
#define SPIPC_CALLSTATE_CONNECTING     (2)
#define SPIPC_CALLSTATE_CONNECTED      (3)
#define SPIPC_CALLSTATE_DISCONNECTING  (4)

/*--------------*/
/*  STRUCTURES  */
/*--------------*/

typedef struct          /* Version-Info */
{
  /* Public info */
  unsigned long  magic;
  unsigned char  ifver;
  unsigned char  ifrev;
  unsigned short ifopt;
  unsigned short queues;
  /* Debug info */
  unsigned short dlluse;
  DWORD          creator;
  void          *code;
  void          *data;
} SPIPC_VERSIONINFO;


typedef struct            /* Queue-Info */
{
  /* Public info */
  unsigned long messages;
  unsigned long bytes_total;
  unsigned long bytes_used;
  unsigned long bytes_trigger;
  /* Debug info */
  HANDLE        evt_rxrdy;
  HANDLE        evt_txrdy;
  HWND          hwnd_rxrdy;
  HWND          hwnd_txrdy;
} SPIPC_QUEUEINFO;

/*====*/
                        /*** MESSAGES ***/
typedef struct                /* Header */
{
  unsigned short len;
  unsigned short msg;
  unsigned long  id;
#ifdef _DEBUG_IPCMESSAGES
  unsigned long  time;
#endif
} SPIPC_HEADER;

/*----*/

typedef struct               /* Generic */
{
  SPIPC_HEADER hdr;
  unsigned char data[1];
} SPIPC_MSG_GENERIC;

/*----*/               /** UI->Machine **/

typedef struct    /* Cmd_Version [0000] */
{
  SPIPC_HEADER hdr;
} SPIPC_MSG_CMD_VERSION;


typedef struct       /* Cmd_Ping [0001] */
{
  SPIPC_HEADER hdr;
  unsigned char pingdata[1];
} SPIPC_MSG_CMD_PING;


typedef struct       /* Cmd_Exit [0002] */
{
  SPIPC_HEADER hdr;
} SPIPC_MSG_CMD_EXIT;


typedef struct        /* Cmd_Off [0003] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_OFF;


typedef struct         /* Cmd_On [0004] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_ON;


typedef struct     /* Cmd_HwInfo [0005] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_HWINFO;


typedef struct    /* Cmd_AutoCfg [0006] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char cfgtype;
  unsigned char mdmport;
  unsigned char mdmtype;
} SPIPC_MSG_CMD_AUTOCFG;


typedef struct     /* Cmd_SetCfg [0007] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char cfgdata[1];
} SPIPC_MSG_CMD_SETCFG;


typedef struct     /* Cmd_GetCfg [0008] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETCFG;

/*--*/

typedef struct  /* Cmd_SetOutVol [0010] */
{
  SPIPC_HEADER hdr;
  unsigned char  phone;
  unsigned char  chan;
  unsigned short volume;
} SPIPC_MSG_CMD_SETOUTVOL;


typedef struct  /* Cmd_GetOutVol [0011] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char chan;
} SPIPC_MSG_CMD_GETOUTVOL;


typedef struct   /* Cmd_SetInVol [0012] */
{
  SPIPC_HEADER hdr;
  unsigned char  phone;
  unsigned char  _dummy;
  unsigned short volume;
} SPIPC_MSG_CMD_SETINVOL;


typedef struct   /* Cmd_GetInVol [0013] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETINVOL;


typedef struct   /* Cmd_SetInMux [0014] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char source;
} SPIPC_MSG_CMD_SETINMUX;


typedef struct   /* Cmd_GetInMux [0015] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETINMUX;

/*--*/

typedef struct    /* Cmd_DtmfOff [0020] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_DTMFOFF;


typedef struct     /* Cmd_DtmfOn [0021] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char tone;
} SPIPC_MSG_CMD_DTMFON;


typedef struct   /* Cmd_DtmfDial [0022] */
{
  SPIPC_HEADER hdr;
  unsigned char  phone;
  unsigned char  diallength;
  unsigned short duration;
  unsigned short spacing;
  unsigned char  dialstring[1];
} SPIPC_MSG_CMD_DTMFDIAL;

/*--*/

typedef struct/* Cmd_SetDecState [0040] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char key[32];
  unsigned char cnt[16];
} SPIPC_MSG_CMD_SETDECSTATE;


typedef struct/* Cmd_GetDecState [0041] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETDECSTATE;


typedef struct /* Cmd_SetDecMode [0042] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char mode;
} SPIPC_MSG_CMD_SETDECMODE;


typedef struct /* Cmd_GetDecMode [0043] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETDECMODE;

           /* Cmd_SetDecCodecTbl [0044] */
typedef struct
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char index;
  unsigned char codec;
} SPIPC_MSG_CMD_SETDECCODECTBL;

           /* Cmd_GetDecCodecTbl [0045] */
typedef struct
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETDECCODECTBL;


typedef struct/* Cmd_GetDecCodec [0046] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETDECCODEC;


typedef struct /* Cmd_GetDecSync [0047] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETDECSYNC;

/*--*/

typedef struct/* Cmd_SetEncState [0060] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char key[32];
  unsigned char cnt[16];
} SPIPC_MSG_CMD_SETENCSTATE;


typedef struct/* Cmd_GetEncState [0061] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETENCSTATE;


typedef struct /* Cmd_SetEncMode [0062] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char mode;
} SPIPC_MSG_CMD_SETENCMODE;


typedef struct /* Cmd_GetEncMode [0063] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETENCMODE;

           /* Cmd_SetEncCodecTbl [0064] */
typedef struct
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char index;
  unsigned char codec;
} SPIPC_MSG_CMD_SETENCCODECTBL;

           /* Cmd_GetEncCodecTbl [0065] */
typedef struct
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETENCCODECTBL;


typedef struct/* Cmd_SetEncCodec [0066] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char index;
} SPIPC_MSG_CMD_SETENCCODEC;


typedef struct/* Cmd_GetEncCodec [0067] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_GETENCCODEC;

/*--*/

typedef struct /* Cmd_TxUserData [0080] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char userdata[1];
} SPIPC_MSG_CMD_TXUSERDATA;

/*--*/

typedef struct  /* Cmd_GetRandom [00E0] */
{
  SPIPC_HEADER hdr;
  unsigned short bitcount;
  unsigned char  lessok;
} SPIPC_MSG_CMD_GETRANDOM;

/*--*/

typedef struct     /* Cmd_Hangup [0100] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_HANGUP;


typedef struct     /* Cmd_Answer [0101] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_CMD_ANSWER;


typedef struct       /* Cmd_Dial [0102] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char media;
  unsigned char service;
  unsigned char carrier;
  unsigned char protocol;
  unsigned char diallength;
  unsigned char dialstring[1];
} SPIPC_MSG_CMD_DIAL;

/*----*/               /** Machine->UI **/

typedef struct    /* Res_Version [8000] */
{
  SPIPC_HEADER hdr;
  unsigned char major;
  unsigned char minor;
  unsigned char revision;
} SPIPC_MSG_RES_VERSION;


typedef struct       /* Res_Pong [8001] */
{
  SPIPC_HEADER hdr;
  unsigned char pongdata[1];
} SPIPC_MSG_RES_PONG;


typedef struct       /* Res_Exit [8002] */
{
  SPIPC_HEADER hdr;
  unsigned char term;
} SPIPC_MSG_RES_EXIT;


typedef struct         /* Res_Ok [8003] */
{
  SPIPC_HEADER hdr;
  signed short result;
} SPIPC_MSG_RES_OK;


typedef struct      /* Res_Error [8004] */
{
  SPIPC_HEADER hdr;
  signed short result;
} SPIPC_MSG_RES_ERROR;


typedef struct     /* Res_HwInfo [8005] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char hwinfo[1];
} SPIPC_MSG_RES_HWINFO;


typedef struct     /* Res_GetCfg [8006] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char cfgdata[1];
} SPIPC_MSG_RES_GETCFG;

/*--*/

typedef struct  /* Res_GetOutVol [8010] */
{
  SPIPC_HEADER hdr;
  unsigned char  phone;
  unsigned char  chan;
  unsigned short volume;
} SPIPC_MSG_RES_GETOUTVOL;


typedef struct   /* Res_GetInVol [8011] */
{
  SPIPC_HEADER hdr;
  unsigned char  phone;
  unsigned char  _dummy;
  unsigned short volume;
} SPIPC_MSG_RES_GETINVOL;


typedef struct   /* Res_GetInMux [8012] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char source;
} SPIPC_MSG_RES_GETINMUX;

/*--*/

typedef struct/* Res_GetDecState [8040] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char key[32];
  unsigned char cnt[16];
} SPIPC_MSG_RES_GETDECSTATE;


typedef struct /* Res_GetDecMode [8041] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char mode;
} SPIPC_MSG_RES_GETDECMODE;

           /* Res_GetDecCodecTbl [8042] */
typedef struct
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char codec[2];
} SPIPC_MSG_RES_GETDECCODECTBL;


typedef struct/* Res_GetDecCodec [8043] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char index;
} SPIPC_MSG_RES_GETDECCODEC;


typedef struct /* Res_GetDecSync [8044] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char sync;
} SPIPC_MSG_RES_GETDECSYNC;

/*--*/

typedef struct/* Res_GetEncState [8060] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char key[32];
  unsigned char cnt[16];
} SPIPC_MSG_RES_GETENCSTATE;


typedef struct /* Res_GetEncMode [8061] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char mode;
} SPIPC_MSG_RES_GETENCMODE;

           /* Res_GetEncCodecTbl [8062] */
typedef struct
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char codec[2];
} SPIPC_MSG_RES_GETENCCODECTBL;


typedef struct/* Res_GetEncCodec [8063] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char index;
} SPIPC_MSG_RES_GETENCCODEC;

/*--*/

typedef struct  /* Res_GetRandom [80E0] */
{
  SPIPC_HEADER hdr;
  unsigned short bitcount;
  unsigned char  rnddata[1];
} SPIPC_MSG_RES_GETRANDOM;

/*--*/

typedef struct /* Res_Disconnect [8100] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char reason;
  signed short  result;
} SPIPC_MSG_RES_DISCONNECT;


typedef struct    /* Res_Connect [8101] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char dialout;
  unsigned char media;
  unsigned char service;
  unsigned long baudrate;
  unsigned char carrier;
  unsigned char protocol;
  unsigned char remnumlen;
  unsigned char remnumdata[1];
} SPIPC_MSG_RES_CONNECT;

/*----*/

typedef struct   /* Pro_NewState [8200] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char state;
} SPIPC_MSG_PRO_NEWSTATE;


typedef struct/* Pro_HangupStart [8201] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_PRO_HANGUPSTART;


typedef struct/* Pro_AnswerStart [8202] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_PRO_ANSWERSTART;


typedef struct  /* Pro_DialStart [8203] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char media;
  unsigned char service;
  unsigned char carrier;
  unsigned char protocol;
  unsigned char diallength;
  unsigned char dialstring[1];
} SPIPC_MSG_PRO_DIALSTART;

/*----*/

typedef struct    /* Evt_RingOff [8300] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_EVT_RINGOFF;


typedef struct     /* Evt_RingOn [8301] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_EVT_RINGON;


typedef struct       /* Evt_Ring [8302] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_EVT_RING;


typedef struct   /* Evt_CallerId [8303] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char remnumlen;
  unsigned char remnumdata[1];
} SPIPC_MSG_EVT_CALLERID;


typedef struct     /* Evt_Hangup [8304] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
} SPIPC_MSG_EVT_HANGUP;

/*----*/

typedef struct /* Mux_RxUserData [8400] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char userdata[1];
} SPIPC_MSG_MUX_RXUSERDATA;


typedef struct /* Res_TxUserData [8401] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char state;
} SPIPC_MSG_MUX_TXUSERDATA;

/*----*/

typedef struct     /* Prt_RxSync [8500] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char sync;
} SPIPC_MSG_PRT_RXSYNC;


typedef struct    /* Prt_RxCodec [8501] */
{
  SPIPC_HEADER hdr;
  unsigned char phone;
  unsigned char index;
} SPIPC_MSG_PRT_RXCODEC;

/*--------------*/
/*  PROTOTYPES  */
/*--------------*/

SPIPC_PUBLIC int CALLBACK SPIPC_getVersionInfo (SPIPC_VERSIONINFO *info);

SPIPC_PUBLIC int CALLBACK SPIPC_getQueueInfo (unsigned char queue, \
                                        SPIPC_QUEUEINFO *info);

SPIPC_PUBLIC int CALLBACK SPIPC_setNotifyWnd (unsigned char queue,  \
                                        unsigned char notify, HWND hwnd);
/*----*/

SPIPC_PUBLIC int CALLBACK SPIPC_putMessage (unsigned char        queue,   \
                                      const unsigned char *data,    \
                                      unsigned long        timeout);

SPIPC_PUBLIC int CALLBACK SPIPC_getMessage (unsigned char   queue, \
                                      unsigned char  *data,  \
                                      unsigned short *size,  \
                                      unsigned long   timeout);

#endif


/*** EOF ***/
